<?php
/*
* @Name:list.php
* @Version:1.0
* @Use: to list a page with many keywords.
* @Author: CoderChao
*/

include 'config.php';
include 'function.php';
$DomainName = 'http://'.$_SERVER['SERVER_NAME'];    //http://www.baidu.com
$SearchString   = str_replace('-', ' ', clean_keyword($_GET['s']));
$UCKeyWord      = ucwords($SearchString);
?>
<!doctype html>
<html>
    <head>
        <meta charset="utf-8">
        <title>Category : <?php echo $UCKeyWord; ?></title>
        <meta name="robots" content="index,follow">
        <link rel="shortcut icon" type="image/x-icon" href="<?php echo $DomainName;?>/favicon.ico">
        <link rel="stylesheet" href="<?php echo $DomainName;?>/style/global.css" />
        <link rel="stylesheet" href="<?php echo $DomainName;?>/style/index.css" />
    </head><!--head end -->
    <body id="index">
		<div id="page" class="w950">
            <div id="header">
			<h1 id="logo">
                    <a href="<?php echo $DomainName; ?>/category/<?php echo $_GET['s']; ?>" title="Category of <?php echo $UCKeyWord;?>"><img src="/style/logo.jpg" alt="Category of <?php echo $UCKeyWord;?>"  width="400" height="104" /></a>
            </h1><!-- #site-nav END --> 
            </div><!-- #header END -->
            <div class="search-form">
                <fieldset>
                    <legend>Search</legend>
                    <form action="/search.php" method="get" id="J_searchForm">
                        <ul class="search-tab" id="J_SearchTab">
                            <li class="selected first"><s class="l"></s><s class="r"></s><a>Products</a></li>
                        </ul>
                        <div class="search-auto">
                            <s class="l"></s>
                            <s class="r"></s>
                            <div class="input allWidth">
                                <input  accesskey="s" name="s" maxlength="60" id="title" placeholder="Type Text to Search for <?php echo $SiteName;?>..." autofocus  x-webkit-speech x-webkit-grammar="builtin:translate" />
                            </div>
                            <button type="submit">Search</button>
                        </div>
                    </form>
                </fieldset>
            </div><!--search form end -->
<?php
    $KeywordsArray = get_keywords_array('./','home');  //get the keywords array
	shuffle($KeywordsArray);	//shuffle the array
?>
		<div class="bang bang-index"><!--#top start -->
			<div class="grow">
		 		<h5><i class="icon"></i><?php echo $UCKeyWord; ?></h5>
            	<ol>
            		<?php 
            		for ($i=1; $i < 31; $i++) {?>
            		<li style="white-space: nowrap;overflow: hidden;"<?php if ($i < 11) echo ' class="first"';?>>
		        	<i><?php echo $i;?></i>
		        	<a href="<?php echo $DomainName; ?>/<?php echo $KeywordsArray[$i]; ?>.html" title="<?php echo title_words($KeywordsArray[$i]); ?>"><?php echo title_words($KeywordsArray[$i]); ?></a>
					</li>
					<?php } ?>
				</ol>
        	</div><!--#grow end -->
        	<div class="hot">
	            <h5><i class="icon"></i>Leaders</h5>
	            <ol>
	            	<?php 
            		for ($i=1; $i < 31; $i++) {?>
            		<li style="white-space: nowrap;overflow: hidden;"<?php if ($i < 11) echo ' class="first"';?>>
		        	<i><?php echo $i;?></i>                   
                    <a href="<?php echo $DomainName; ?>/<?php echo $KeywordsArray[$i+40]; ?>.html"><?php echo title_words($KeywordsArray[$i+40]); ?></a>
					</li>
					<?php } ?>
				</ol>
			</div><!--#hot end -->
			<div class="more">
				<h5><i class="icon"></i>Hotters</h5>
				<ol>
                    <?php 
                    for ($i=1; $i < 31; $i++) {?>
                    <li style="white-space: nowrap;overflow: hidden;"<?php if ($i < 11) echo ' class="first"';?>>
                    <i><?php echo $i;?></i>
                    <a href="<?php echo $DomainName; ?>/<?php echo $KeywordsArray[$i+20]; ?>.html" title="<?php echo title_words($KeywordsArray[$i+20]); ?>"><?php echo title_words($KeywordsArray[$i+20]); ?></a>
                    </li>
                    <?php } ?>
                </ol>
			</div><!--#more end -->
		</div><!--#top end -->
		<div id="footer">
                <div class="copyright">
                    &copy; 1999 - <?php echo date("Y"); ?> All rights reserved. <?php echo $_SERVER['HTTP_HOST']; ?> <a href="<?php echo $DomainName; ?>/" rel="home"><?php echo $SiteName;?></a> 
                    <?php if (file_exists('sitemap.xml')) {
                        echo '<a href="'.$DomainName.'/sitemap.xml">SiteMap</a>';
                    }else{
                        echo '<a href="'.$DomainName.'/sitemap.php">SiteMap!</a>';
                    }?>
                    <?php 
                    $PageEndTime = microtime();
                    echo ($PageEndTime - $PageStartTime).' s';
                    ?>
                </div>
        </div><!--#footer end -->
        </div><!--#page end -->
    </body>
</html>